<div class="container">
    <div class="row" >
        <div class="span12 blockGray">
            <div class="blockInner">
                <h1>Mis Sucursales</h1>
                <?php
                echo '<a class="btn" href="' . $view->url(array('action' => 'add')) . '" >Agregar sucursal</a>';
                echo '<div class="clear" style="height:15px;" ></div>';
                if (is_array($view->branches) && count($view->branches) > 0)
                {
                    echo '<table class="table table-striped table-bordered table-condensed" >';
                    echo '<tr>';
                    echo '<th>Nombre</th>';
                    echo '<th>Direcci&oacute;n</th>';
                    echo '<th>Estado</th>';
                    echo '<th>Editar</th>';
                    echo '<th>Eliminar</th>';
                    echo '</tr>';
                    foreach ($view->branches as $branche)
                    {
                        echo '<tr>';
                        echo '<td>'.$branche->getName().'</td>';
                        echo '<td>'.$branche->getDirection().'</td>';
                        $status = $branche->getPoint() ? 'En Ruta' : 'En Espera';
                        echo '<td>'.$status.'</td>';
                        echo '<td><a href="' . $view->url(array('action' => 'edit', 'id' => $branche->getId())) . '">Editar</a></td>';
                        echo '<td><a href="' . $view->url(array('action' => 'delete', 'id' => $branche->getId())) . '">Eliminar</a></td>';
                        echo '</td>';
                    }
                    echo '</table>';
                }
                else
                {
                    echo '<div class="alert alert-block">';
                    echo 'Aun no tiene Sucursales';
                    echo '</div>';
                }
                ?>
            </div>
        </div>
    </div>
</div>
